package com.plian.system.wrapper.qg.subsidiary;

import com.plian.system.dto.qg.subsidiary.SubsidiaryMixedReformDTO;
import com.plian.system.entity.qg.subsidiary.SubsidiaryIntroduceReform;
import com.plian.system.entity.qg.subsidiary.SubsidiaryMixedReform;
import com.plian.system.mybatis.support.BaseWrapper;
import com.plian.system.vo.qg.subsidiary.SubsidiaryMixedReformVO;
import com.plian.system.wrapper.util.CacheWrapperUtil;
import com.plian.system.wrapper.util.WrapperUtil;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

import static com.plian.system.wrapper.util.WrapperConstant.*;

/**
 * 子企业混合所有制改革进展包装类,返回视图层所需的字段
 *
 * @author jianglei
 * @since 2019-11-05
 */
@Mapper(componentModel = SPRING, uses = {CacheWrapperUtil.class, WrapperUtil.class})
public interface SubsidiaryMixedReformWrapper extends BaseWrapper<SubsidiaryMixedReform, SubsidiaryMixedReformDTO, SubsidiaryMixedReformVO> {

    /**
     * Entity转VO
     *
     * @param entity /
     * @return /
     */
    @Override
    @Mappings(value = {
            @Mapping(source = "mixedEnterpriseId", target = "mixedEnterpriseName", qualifiedByName = PROPERTY_ID_NAME),
            @Mapping(source = "createUser", target = "createUserName", qualifiedByName = USER_ID_TO_NAME),
            @Mapping(source = "updateUser", target = "updateUserName", qualifiedByName = USER_ID_TO_NAME),
            @Mapping(source = "approvedUser", target = "approvedUserName", qualifiedByName = USER_ID_TO_NAME),
            @Mapping(source = "unitRankId", target = "unitRankName", qualifiedByName = DICT_CODE_TO_NAME),
            @Mapping(source = "majorIndustryId", target = "majorIndustryIds", qualifiedByName = STRING_TO_LIST),
            @Mapping(source = "majorIndustryId", target = "majorIndustryNames", qualifiedByName = DICT_CODE_LIST_TO_NAME_LIST),
            @Mapping(source = "majorIndustryId", target = "majorIndustryNameStr", qualifiedByName = DICT_CODE_LIST_TO_NAME),
            @Mapping(source = "mixedModeId", target = "mixedModeIds", qualifiedByName = STRING_TO_LIST),
            @Mapping(source = "mixedModeId", target = "mixedModeNames", qualifiedByName = DICT_CODE_LIST_TO_NAME_LIST),
            @Mapping(source = "mixedModeId", target = "mixedModeNameStr", qualifiedByName = DICT_CODE_LIST_TO_NAME),
            @Mapping(source = "functionalCategoryId", target = "functionalCategoryName", qualifiedByName = DICT_CODE_TO_NAME),
            @Mapping(source = "mixedType", target = "mixedTypeName", qualifiedByName = DICT_CODE_TO_NAME),
            @Mapping(source = "mixedCategoryId", target = "mixedCategoryName", qualifiedByName = DICT_CODE_TO_NAME),
            @Mapping(source = "stateFundedRelation", target = "stateFundedRelationName", qualifiedByName = DICT_CODE_TO_NAME),
            @Mapping(source = "outType", target = "outTypeName", qualifiedByName = REFORM_OUT_TYPE)
    })
    SubsidiaryMixedReformVO entityToVO(SubsidiaryMixedReform entity);

    @Mappings(value = {
            @Mapping(source = "companyId", target = "mixedEnterpriseId"),
            @Mapping(source = "companyRankId", target = "unitRankId")
    })
    SubsidiaryMixedReform introduceToMixed(SubsidiaryIntroduceReform introduceReform);

    List<SubsidiaryMixedReform> introduceToMixed(List<SubsidiaryIntroduceReform> introduceReformList);
}
